//
//  Constants.h
//  BaseProject
//
//  Created by jiyingxin on 15/10/21.
//  Copyright © 2015年 Tarena. All rights reserved.
//

#ifndef Constants_h
#define Constants_h

/** 预防性处理：必须使用指定的初始化方法 */
#define kMustUseTheSpecialMethod    - (instancetype)init\
{\
    self = [super init];\
    if (self) {\
        NSAssert1(NO, @"%s:必须使用指定的初始化方法", __func__);\
    }\
    return self;\
}\


 #define  myLog(...)  NSLog(__VA_ARGS__)

/** 设置状态了为亮色 */
#define kSetStatusBarLight  - (UIStatusBarStyle)preferredStatusBarStyle{\
    return UIStatusBarStyleLightContent;\
}\


/** 导航栏题目文字大小 */
#define kNaviTitleFontSize   20.0
/** 导航栏题目文字颜色 */
#define kNaviTitleColor    [UIColor colorWithWhite:1.0 alpha:1.0]


// 是否是iOS7.0以上版本
#define  iOS7   ([[UIDevice currentDevice].systemVersion doubleValue] > 7.0)


// 标题字体大小
#define kTitleFont          [UIFont systemFontOfSize:18]
// 小标题字体大小
#define kSubTitleFont       [UIFont systemFontOfSize:14]
// 小标题字体颜色
#define kSubTitleColor      [UIColor lightGrayColor]


//通过RGB设置颜色
#define kRGBColor(R,G,B)        [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0]

#define kRGBAColor(R,G,B,al)        [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:al/1.0]
// 红色
#define kRedColor   kRGBColor(183, 24, 33)
// 随机色
#define kRandomColor    kRGBColor(arc4random_uniform(256)
// 背景色
#define kBackgroundColor    kRGBColor(218, 218, 218)
#define kNaviBackgroundColor  kRGBColor(215,22,32)

//个人HeaderView背景
#define kHeaderImageBackColor kRGBAColor(215,22,32,0.9)

#define kWindowH   [UIScreen mainScreen].bounds.size.height //应用程序的屏幕高度
#define kWindowW    [UIScreen mainScreen].bounds.size.width  //应用程序的屏幕宽度

#define kAppDelegate ((AppDelegate*)([UIApplication sharedApplication].delegate))

#define kStoryboard(StoryboardName)     [UIStoryboard storyboardWithName:StoryboardName bundle:nil]

//通过Storyboard ID 在对应Storyboard中获取场景对象
#define kVCFromSb(VCID, SbName)     [[UIStoryboard storyboardWithName:SbName bundle:nil] instantiateViewControllerWithIdentifier:VCID]

//移除iOS7之后，cell默认左侧的分割线边距
#define kRemoveCellSeparator \
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{\
cell.separatorInset = UIEdgeInsetsZero;\
cell.layoutMargins = UIEdgeInsetsZero; \
cell.preservesSuperviewLayoutMargins = NO; \
}\


#define interface_sharedStance\
+(UINavigationController *)sharedStance;


#define implementation_sharedStance(class)\
+(UINavigationController *)sharedStance {\
static UINavigationController *navi = nil;\
static dispatch_once_t onceToken;\
dispatch_once(&onceToken, ^{\
class *readVC = [class new];\
navi = [[UINavigationController alloc]initWithRootViewController:readVC];\
});\
return navi;\
}

//Docment文件夹目录
#define kDocumentPath NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject

#endif /* Constants_h */
